﻿    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NewsProgram.Models.NewsItem>" %>


    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
        <fieldset id="noBorderFieldset">
            <div class="editor-label">
                Fyrirsögn
            </div>
            <div class="editor-field">

                <%: Html.TextBoxFor(model => model.Title, new { @class = "titleInput" })%>
                <%: Html.ValidationMessageFor(model => model.Title) %>
            </div>
            
            <div class="editor-label">
                Fréttatexti
            </div>
            <div class="editor-field">
                <%: Html.TextAreaFor(model => model.NewsText, new { @class = "newsInput" })%>
                <%: Html.ValidationMessageFor(model => model.NewsText) %>
            </div>
            

            <div class="editor-label">
                Tegund:
            </div>
            <div class="editor-field">
                <%: 
                    Html.DropDownListFor(
                    model => model.Category, 
                    new SelectList(
                            new List<Object>{ 
                            new { value = 1 , text = "Sports"  },
                            new { value = 2 , text = "News" },
                            new { value = 3 , text = "Politics"}
                    },
                  "value",
                  "text",
                   Model.Category
                        )    
                   )

                %>
                <%: Html.ValidationMessageFor(model => model.Category) %>
            </div>

            <div class="editor-label">
                Frétt bætt við:
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.DateAdded)%>
                <%: Html.ValidationMessageFor(model => model.DateAdded)%>
            </div>


                
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%: Html.ActionLink("Til baka á forsíðu", "Index") %>
    </div>